package sample;

import javafx.stage.DirectoryChooser;
import javafx.stage.Stage;

import java.io.File;

/**
 * Created by lilongfei on 2016/12/15.
 */
public class FolderApp {

    public String open(){
        Stage fileStage = new Stage();
        fileStage.setTitle("工作目录");
        DirectoryChooser fileChooser = new DirectoryChooser();
        fileChooser.setTitle("工作目录");
        fileChooser.setInitialDirectory(
                new File(System.getProperty("user.home"))
        );
        File file = fileChooser.showDialog(fileStage);
        if (file != null)
            return file.getAbsolutePath();
        else
            return "";
    }
}
